package com.mayflygeek.mayflyask.util.mailutils;

import java.util.Properties;

import com.mayflygeek.mayflyask.common.MailConfigInfo;
/**
 * @author 蝈蝈 
 * @email guodefu909@126.com
 * @team 蜉蝣极客
 * @link www.mayflygeek.com
 * 发送邮件信息类
 */
public class MailSenderInfo {
	
	// 邮件基本配置信息
	private MailConfigInfo mailConfigInfo;
	
	// 收件人邮箱地址
	private String toAddress;
	
	// 邮件主题
	private String subject;
	
	// 邮件的文本内容
	private String content;
	
	// 开启Session的debug模式，这样就可以查看到程序发送Email的运行状态
	private boolean debug = false;
	
	// 发送html邮件
	private boolean htmlMail = false;
	
	// 是否发送成功
	private boolean sendSuccess = false;
	
	// 邮件附件的文件名
	private String[] attachFileNames;

	public Properties getProperties() {
		Properties p = new Properties();
		p.put("mail.smtp.host", mailConfigInfo.getMailServerHost());
		p.put("mail.smtp.port", mailConfigInfo.getMailServerPort());
		p.put("mail.smtp.auth", mailConfigInfo.isValidate() ? "true" : "false");
		p.put("mail.smtp.connectiontimeout", mailConfigInfo.getConnectionTimeout());
		p.put("mail.smtp.timeout", mailConfigInfo.getTimeout());
		return p;
	}

	public MailConfigInfo getMailConfigInfo() {
		return mailConfigInfo;
	}

	public void setMailConfigInfo(MailConfigInfo mailConfigInfo) {
		this.mailConfigInfo = mailConfigInfo;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public boolean isDebug() {
		return debug;
	}

	public void setDebug(boolean debug) {
		this.debug = debug;
	}

	public boolean isHtmlMail() {
		return htmlMail;
	}

	public void setHtmlMail(boolean htmlMail) {
		this.htmlMail = htmlMail;
	}

	public boolean isSendSuccess() {
		return sendSuccess;
	}

	public void setSendSuccess(boolean sendSuccess) {
		this.sendSuccess = sendSuccess;
	}

	public String[] getAttachFileNames() {
		return attachFileNames;
	}

	public void setAttachFileNames(String[] attachFileNames) {
		this.attachFileNames = attachFileNames;
	}

	public String getToAddress() {
		return toAddress;
	}

	public void setToAddress(String toAddress) {
		this.toAddress = toAddress;
	}

}
